package com.leen.news.feign;

import com.leen.common.vo.ResultVO;
import com.leen.exam.entity.News;
import com.leen.news.feign.factory.NewsFeignClientFallbackFactory;
import com.leen.news.feign.filter.FeignTokenInterceptor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * openfeign暴露类说明 (restTemplate+ribbon)
 *
 * @author admin
 * @date 2021-05-18
 */
@Component
@FeignClient(name = "LEEN-NEWS-SERVICE",configuration = FeignTokenInterceptor.class,fallbackFactory = NewsFeignClientFallbackFactory.class)
public interface INewsFeignClient {

    /**
     * feign中的GetMapping看成restTempalte类
     * @return
     */
    @GetMapping(value = "/news/data")
    ResultVO getNewsData();

    @PostMapping(value = "/newstag/add")
    int  addNewsTag(@RequestBody News news);

}
